package com.example.runner;

import com.example.instance.BootNettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName: BootNettyServerRunner
 * @Author : 13736
 * @Date :2023/7/8  10:32
 * @Description: TODO
 * @Version :1.0
 */
@Slf4j
@Component
public class BootNettyServerRunner implements ApplicationRunner {


    @Value("${socket.server.port:44000}")
    private int port;

    @Resource
    private BootNettyServer bootNettyServer;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        bootNettyServer.bind(port);
        log.info("Netty-Server 启动成功 ！");
    }
}
